﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Bll;

namespace DMSWcfServices
{
    // NOTE: If you change the class name "DmsServices" here, you must also update the reference to "DmsServices" in Web.config.
    public class DmsServices : IDmsServices
    {
        public string getCCFOTReport(string ambient, string distributor, DateTime startDate, DateTime endDate)
        {
            return Bll.CCFOTBlo.getCCFOTReport(ambient, distributor, startDate, endDate).GetXml();
        }
        //FAR
        public List<Dtl.OrderInvoice> getOInvoiceReport(string distributor, DateTime startDate, DateTime endDate, string ambient)
        {
            return Bll.OrderInvoiceBlo.getOInvoiceReport(distributor, startDate, endDate, ambient);
        }
        //FAR
        public List<Dtl.OrderItemsInvoice> getOItemsInvoiceReport(string distributor, DateTime startDate, DateTime endDate, string ambient)
        {
            return Bll.OrderItemsInvoiceBlo.getOrderItemsInvoiceReport(distributor, startDate, endDate, ambient);
        }
        //FAR
        public List<Dtl.OrderItemsInvoice> getOItemsInvoiceByInvoiceReport(string distributor, DateTime startDate, DateTime endDate,string cdInvoice, string ambient)
        {
            return Bll.OrderItemsInvoiceBlo.getOItemsInvoiceByInvoiceReport(distributor, startDate, endDate, cdInvoice,ambient);
        }
        //FAR
        public List<Dtl.OrderInvoice_AUD> getOrderInvoice_AUD_Report(string distributor,string opcionReport_OI, DateTime startDate, DateTime endDate, string ambient)
        {
            return Bll.OrderInvoiceBlo.getOrderInvoice_AUD_Report(distributor,opcionReport_OI, startDate, endDate, ambient);
        }
        //FAR
        public List<Dtl.Surtidos> getSurtidosReport(string cdPais, string ambient)
        {
            return Bll.SurtidosBlo.getSurtidosReport(cdPais, ambient);
        }
        //Eduardo:
        public string QuotaByDistributor(string ambient, string Distributor)
        {
            return Bll.QuotaBlo.getDistributorByQuota(ambient, Distributor).GetXml();

        }
        public string getStockReport(string distributor, DateTime startDate, DateTime endDate, string status, string ambiente)
        {
            return StockBlo.getStockReport(distributor, startDate, endDate, status, ambiente).GetXml();
        }
        //Eduardo:
        public string StoreByDistributor(string ambient, string Distributor)
        {
            return Bll.StoreBlo.getDistributorByStore(ambient, Distributor).GetXml();
        }
       
        public string getVisitReport(string distributor, DateTime startDate, DateTime endDate, string ambiente)
        {
            return Bll.VisitBlo.getVisitReport(distributor, startDate, endDate, ambiente).GetXml();
        }
        public string getCabinetInventoryReport(string distributor, string ambiente)
        {
            return Bll.CabinetInventoryBlo.getCabinetInventoryReport(distributor, ambiente).GetXml(); 
        }
        public string getRegionUserReport(string ambient, string distributor)
        {
            return Dal.RegionUserDao.getRegionUserReport(ambient, distributor).GetXml();
        }
        public string getClassificationReport(string country, string ambiente)
        {
            return Dal.ClassificationDao.getClassificationReport(country,ambiente).GetXml(); ;
        }
        public List<Dtl.Distributors> GetDistributorsDetails()
        {
            return Bll.DistributorBlo.GetDistributorsList();
        }
        public string getDistributorsList(string ambient)
        {
            return Dal.Tools.getDistributorsList(ambient).GetXml();
        }

        public string getCountryList(string ambiente) {
            return Dal.Tools.getCountryList(ambiente).GetXml();
        }

        public string getCityReport(string ambient, string distributor)
        {
            return Bll.CityBlo.getCityReport(ambient, distributor).GetXml();
        }

        public string getProductReport(string ambient, string country)
        {
            return Bll.ProductBlo.getProductReport(ambient, country).GetXml();
        }

        public string getImportClass(string country, string ambiente) {
            return Bll.ImportClassificationBlo.getImportClassification(country, ambiente).GetXml();
        }
        public string getImportClassH(string country, string ambiente)
        {
            return Bll.ClassificationHierarchyBlo.getClassificationH(country, ambiente).GetXml();
        }
        public string getCurrency(string ambiente)
        {
            return Bll.CurrencyBlo.getCurrency(ambiente).GetXml(); ;
        }
        public string getRouteReport(string ambient, string distributor)
        {
            return Bll.RouteBlo.getRouteReport(ambient, distributor).GetXml();
        }
        public int setConversion(Dtl.Conversion conversion, string ambiente) 
        {
            return Bll.ConversionBlo.setConversion(conversion, ambiente);
        }
        public int editConversion(Dtl.Conversion conversion, string ambiente)
        {
            return Bll.ConversionBlo.editConversion(conversion, ambiente);
        }
        public string getConversion(int idCurrencyTo, int idCurrencyFrom, short nrYear, string ambiente)
        {
            return Bll.ConversionBlo.getConversion(idCurrencyTo,idCurrencyFrom, nrYear, ambiente).GetXml();
        }
        public string listConversion(string ambiente) 
        {
            return Bll.ConversionBlo.listConversion(ambiente).GetXml();
        }
        public int setUnit(Dtl.Unit unit, string ambiente)
        {
            return Bll.UnitBlo.setUnit(unit, ambiente);
        }

        public string getUnit(short idUnit, string ambiente)
        {
            return Bll.UnitBlo.getUnit(idUnit, ambiente).GetXml();
        }

        public string listUnit(string ambiente)
        {
            return Bll.UnitBlo.listUnit(ambiente).GetXml();
        }

        public int editUnit(Dtl.Unit unit, string ambiente) 
        {
            return Bll.UnitBlo.editUnit(unit, ambiente);
        }

        public string getDistributorsFTPProgress(string ambient, string minRows)
        {
            return Bll.FTPBlo.getDistributorsFTPProgress(ambient, minRows).GetXml();
        }
        
        public string getTriStateFTPReport(string ambient, DateTime startDate, DateTime endDate)
        {
            return Bll.FTPBlo.getTriStateFTPReport(ambient, startDate, endDate).GetXml();
        }
        public string getDistributorsFTPActivity(string ambient, DateTime startDate, DateTime endDate, bool date)
        {
            return Bll.FTPBlo.getDistributorsFTPActivity(ambient, startDate, endDate, date).GetXml();
        }
        public string getDistributorsFTPStatus(string ambient)
        {
            return Bll.FTPBlo.getDistributorsFTPStatus(ambient).GetXml();
        }
        public string getUnileverFTPStatus(string ambient)
        {
            return Bll.FTPBlo.getUnileverFTPStatus(ambient).GetXml();
        }

        public bool SetTransactionUnit(List<Dtl.Unit> unit, string ambiente)
        {
            return Bll.UnitBlo.SetTransactionUnit(unit, ambiente);
        }
        //Eduardo:
        public string QuotaUByDistributor(string ambient, string country)
        {
            return Bll.QuotaUBlo.getDistributorByQuotaU(ambient, country).GetXml();
        }

        public int deleteUnit(int idUnit, string ambiente)
        {
            return Bll.UnitBlo.deleteUnit(idUnit, ambiente);
        }
    }
}
